package com.topscomm.mis.cbb.file.compare.main;

import com.topscomm.pub.util.SpringUtil;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.FilterType;
import org.springframework.transaction.PlatformTransactionManager;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import org.springframework.transaction.annotation.TransactionManagementConfigurer;

import javax.annotation.Resource;

/**
 * @description:
 * @author: zhanglongfei
 * @date: 2023/2/23 9:31
 */
@SpringBootApplication
@EnableTransactionManagement
@ComponentScan(basePackages = { "com.topscomm" })
public class CompareApp implements TransactionManagementConfigurer {
    @Resource(name = "transactionManager")
    private PlatformTransactionManager defaultTxManager;

    public static void main(String[] args) {
        ApplicationContext ctx = SpringApplication.run(CompareApp.class, args);
        SpringUtil springUtil = (SpringUtil) SpringUtil.getBean("springUtil");
        springUtil.setApplicationContext(ctx);
    }

    @Override
    public PlatformTransactionManager annotationDrivenTransactionManager() {
        return defaultTxManager;
    }
}
